Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Conversation

msalsouri
Copy link
Owner

Creating the dynamic webapp using naming convention: msalsouri-skills-deploy-to-azure-app

Comment on lines +17 to +40
name: 🛠 Build Frontend
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16
- name: npm install and build webpack

- name: Install & Build Webpack
run: |
npm install
npm ci
npm run build
- uses: actions/upload-artifact@v4

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: webpack artifacts
name: webpack-artifacts
path: public/

Build-Docker-Image:
docker_build:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines 41 to 78
name: 🐳 Build & Push Docker Image
runs-on: ubuntu-latest
needs: build
name: Build image and store in GitHub Container Registry

steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v4

- name: Download built artifact
- name: Download Webpack Artifacts
uses: actions/download-artifact@v4
with:
name: webpack artifacts
name: webpack-artifacts
path: public

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_REGISTRY_URL }}
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}

- name: Extract metadata (tags, labels) for Docker
- name: Extract Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{env.IMAGE_REGISTRY_URL}}/${{ github.repository }}/${{env.DOCKER_IMAGE_NAME}}
images: ${{ env.IMAGE_REGISTRY_URL }}/${{ github.repository }}/${{ env.DOCKER_IMAGE_NAME }}
tags: |
type=sha,format=long,prefix=

- name: Build and push Docker image
- name: Build & Push Image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

Deploy-to-Azure:
deploy:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines +16 to +40
name: Build front-end assets
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'deploy-staging')

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16
- name: npm install and build webpack

- name: Install dependencies and build
run: |
npm install
npm ci
npm run build
- uses: actions/upload-artifact@v4

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: webpack artifacts
name: webpack-artifacts
path: public/

Build-Docker-Image:
docker_build:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines 41 to 78
name: Build and push Docker image to GHCR
runs-on: ubuntu-latest
needs: build
name: Build image and store in GitHub Container Registry

steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v4

- name: Download built artifact
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: webpack artifacts
name: webpack-artifacts
path: public

- name: Log in to GHCR
- name: Log in to GitHub Container Registry (GHCR)
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_REGISTRY_URL }}
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}

- name: Extract metadata (tags, labels) for Docker
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{env.IMAGE_REGISTRY_URL}}/${{ github.repository }}/${{env.DOCKER_IMAGE_NAME}}
images: ${{ env.IMAGE_REGISTRY_URL }}/${{ github.repository }}/${{ env.DOCKER_IMAGE_NAME }}
tags: |
type=sha,format=long,prefix=

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

Deploy-to-Azure:
deploy:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines +67 to +84
name: 🧨 Destroy Azure Environment
runs-on: ubuntu-latest

if: contains(github.event.pull_request.labels.*.name, 'destroy environment')

steps:
- name: Checkout repository
- name: Checkout Repository
uses: actions/checkout@v4

- name: Azure login
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Destroy Azure environment
if: success()
- name: Delete Resource Group
run: |
az group delete --name ${{env.AZURE_RESOURCE_GROUP}} --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --yes
az group delete \
--name "${{ env.AZURE_RESOURCE_GROUP }}" \
--subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}" \
--yes

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant